package com.example.tb.controller;

import com.example.tb.entity.BiOpeningRecord;
import com.example.tb.service.BiOpeningRecordService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.io.File;
import java.util.ArrayList;

@Slf4j
@RestController
@RequestMapping("/parsingFile")
public class ParseDocumentController {

    @Resource
    private BiOpeningRecordService biOpeningRecordService;


    @GetMapping("/parsingFile")
    public String parsingFile() {
        ArrayList<String> objects = new ArrayList<>();
        File file = new File("D:/dev/未读xls文件");
        ArrayList<String> filename = biOpeningRecordService.traversalFile(file);
        for (int i = 0; i < filename.size(); i++) {
            try {
                File f1 = new File(filename.get(i));
                System.out.println(f1);
                ArrayList<BiOpeningRecord> arrayList = biOpeningRecordService.readExcel(f1);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return "OK";
    }
}